package com.kongge.viewdisplayframeworklib.event.param;

import android.util.SparseArray;

import com.kongge.viewdisplayframeworklib.model.Page;

import java.util.LinkedList;
import java.util.List;

public class EQParam implements ClassType {

	// ~常量区块
	// ========================================================
	/**
	 * 定义参数类型
	 */
	public static final int TYPE_EQPARAM                                     = 0;
	public static final int PARAM_TYPE_STOCKINFO = 1;
	public static final int PARAM_TYPE_TECH_STOCKINFO = 2;
	public static final int PARAM_TYPE_GOTO = 3;
	public static final int PARAM_TYPE_LANDS_TO_PORTRAIT = 100;

	// ~成员变量区块
	// ========================================================
	// 参数类型
	private int mValueType;
	
	/**
	 * 参数列表
	 */
	private SparseArray<Object> mValueList;
	// 参数值
	private Object mValue;
	public Page page;  // 分发数据类的索引

	private List<Integer> targetReceivePageIdList;

	// ~构造函数区块
	// ========================================================
	public EQParam(int valueType, Object value) {
		mValueType = valueType;
		mValue = value;
		mValueList = new SparseArray<Object>();
	}

	// ~方法区块
	// ========================================================
	/**
	 * 获取参数类型
	 */
	public int getValueType() {
		return mValueType;
	}
	
	/**
	 * 获取参数值
	 * @return
	 */
	public Object getValue() {
		return mValue;
	}
	
	/**
	 * 设置参数
	 * @param value
	 */
	public void setValue(Object value) {
		mValue = value;
	}
	
	/**
	 * 设置参数
	 * @param key
	 * @param value
	 */
	public void setValue(int key, Object value) {
		mValueList.put(key, value);
	}
	
	public Object getValue(int key) {
		return mValueList.get(key);
	}
	
	@Override
	public int getClassType() {
		// TODO Auto-generated method stub
		return TYPE_EQPARAM;
	}
	
	public void setValueType(int type) {
		mValueType = type;
	}

	public void addTargetReceivePageId(int pageId) {
		if (targetReceivePageIdList == null) {
			targetReceivePageIdList = new LinkedList<>();
		}
		targetReceivePageIdList.add(pageId);
	}

	public List<Integer> getTargetReceivePageIdList() {
		return targetReceivePageIdList;
	}

	// ~静态方法区块
	// ========================================================

	// ~内部接口（类）区块
	// ========================================================

}
